#include <Arduino.h>
#include <ArduinoJson.h>

float speed_x, speed_z;
String data =  "{\"x\": 0.5, \"z\": 0.0}";


 void setup() {
    // 初始化串口
    Serial.begin(115200);
    JsonDocument doc;
    deserializeJson(doc, data);
    speed_x = doc["x"].as<float>(); 
    speed_z = doc["z"].as<float>(); 


}
 
void loop() {

    Serial.print("x: ");
    Serial.println(speed_x);
    Serial.print("z: ");
    Serial.println(speed_z);
    delay(1000);
}
